from random import randint


def random_divider(total, divide):
    if total < divide:
        return None
    arr = []
    for _ in range(divide):
        arr.append(randint(1, total))
    sum_num = sum(arr.__iter__())
    s = sum_num / float(total)
    arr_iter = map(lambda x: x / s, arr)
    new_arr = []
    while True:
        try:
            n = int(next(arr_iter))
            if n < 1:
                n = 1
            new_arr.append(n)
        except StopIteration:
            break
    d = total - sum(new_arr.__iter__())
    if d > 0:
        new_arr[0] += d
    elif d < 0:
        for i in range(divide):
            if new_arr[i] + d > 0:
                new_arr[i] += d
                break
    # if 0 in new_arr:
    #     print('---sum--', sum(new_arr.__iter__()), '0 in new_arr 0 in new_arr 0 in new_arr 0 in new_arr', new_arr)

    # if 1 in new_arr:
    #     print('---sum--', sum(new_arr.__iter__()), '1 in new_arr', new_arr)

    return new_arr


# for _ in range(20):
#     print(random_divider(40, 50))
#     print(sum(random_divider(2000, 5)))